package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-07-04
 * Time: 9:12
 */
public class AddOperation implements IOperation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("增加图书");
        System.out.println("请输入书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入作者");
        String author = scanner.nextLine();
        System.out.println("请输入类型");
        String type = scanner.nextLine();
        System.out.println("请输入价格");
        int price = scanner.nextInt();
        Book book = new Book(name,author,type,price);
        int current = booklist.getUesdsize();
        booklist.setBook(current,book);
        System.out.println("添加成功");
        booklist.setUesdsiz(current+1);


    }
}
